<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户角色配置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <#include "../../include/layui.ftl" />
    <style>
        .layui-table-click{
            background-color: #FFE48D;
        }
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <form class="layui-form layui-form-pane" action="/console/user/rewrite/config" lay-filter="layer-from" onsubmit="beforeSubmit()">
            <input type="hidden" name="id">
            <input type="hidden" name="roleId">
            <div class="layui-form-item" hidden>
                <div class="layui-input-block">
                    <button id="permissionSubmit" class="layui-btn" lay-submit lay-filter="*" >
                        保存
                    </button>
                </div>
            </div>
        </form>
        <div class="layui-card-body">
            <table id="lay-table" lay-filter="lay-table"></table>
        </div>
    </div>
</div>
<script>
    var $ = null;
    var data = "";
    layui.config({
        base: '${path}/plug-in/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','tables','form','layer'],function () {
        var tables = layui.tables,
            layer = layui.layer,
            form = layui.form,
            table = layui.table;
            $ = layui.$;
        var parmer = {
            url: "/console/com.fs.common.pojo.Role/list",
            toolbar: false,
            height: 'full-50',
            cols:[[
                {type:'numbers'}
                ,{field:"roleName",width:200,title:"角色名称"}
                ,{field:"roleDesc",width:200,title:"角色描述"}
            ]]
        };
        var $tables = tables.renderTable(parmer);

        form.val("layer-from", $.extend(true,{},parent._data));

        //监听table单击事件
        table.on('row(lay-table)', function(obj){
            var $tr = $(".layui-table tbody tr");
            $tr.removeClass("layui-table-click");
            obj.tr.addClass("layui-table-click");
            data = obj.data;
        });
    });

    function beforeSubmit() {
        $("input[name=roleId]").val(data.id);
    }
</script>
</body>
</html>